package cn.cocho.android.mct.file;

import static org.junit.Assert.*;

import java.util.Properties;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import cn.cocho.android.mc.file.PropertiesUtils;

/**
 * Properties工具包测试用例
 * 
 * @author yzl
 * @time 2013-5-3下午3:19:07
 */
public class PropertiesUtilsTest {

	String proPath=FileUtilsTest.getCurrentPath()+"\\test\\project.properties";
	@Before
	public void setUp() throws Exception {
	}

	@Test
//	@Ignore
	public void testGetProperties() {
		Properties pro=PropertiesUtils.getProperties(proPath);
		String value=pro.get("target").toString();
		assertEquals("获取Properties失败！", "android-8", value);
	}

	@Test
//	@Ignore
	public void testGetValue() {
		String value=PropertiesUtils.getValue(proPath, "target").toString();
		assertEquals("获取Properties失败！", "android-8", value);
	}

	@Test
//	@Ignore
	public void testPut() {
		PropertiesUtils.put(proPath, "testPut", "123qwe");
	}

	@Test
//	@Ignore
	public void testSave() {
		String path=FileUtilsTest.getCurrentPath()+"\\test\\project1.properties";
		Properties pro=PropertiesUtils.getProperties(path);
		String proPath=FileUtilsTest.getCurrentPath()+"\\test\\project.txt";
		PropertiesUtils.save(proPath, pro);
	}

}
